﻿<UserControl xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             xmlns:ee="http://schemas.microsoft.com/expression/2010/effects"
             xmlns:local="clr-namespace:MainGameModule.Views"
             xmlns:TiledBG="clr-namespace:TiledBG;assembly=TiledBG"
             xmlns:controls="clr-namespace:MainGameModule"
             xmlns:converters="clr-namespace:MainGameModule.Views.Converters"
             xmlns:prism="clr-namespace:Microsoft.Practices.Composite.Presentation.Regions;assembly=Microsoft.Practices.Composite.Presentation"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
             xmlns:ei="http://schemas.microsoft.com/expression/2010/interactions"
             xmlns:ec="http://schemas.microsoft.com/expression/2010/controls"
             xmlns:ed="http://schemas.microsoft.com/expression/2010/drawing"
             xmlns:System="clr-namespace:System;assembly=mscorlib"
             mc:Ignorable="d"
             x:Class="MainGameModule.Views.GameControlsView">

    <UserControl.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="/YourWorld.Common;component/Styles/CommonResourcesDictionary.xaml" />
            </ResourceDictionary.MergedDictionaries>
            <Style TargetType="TextBlock"
                   x:Key="TopRibbonLabelStyle">
                <Setter Property="Foreground"
                        Value="White" />
                <Setter Property="FontFamily"
                        Value="Segoe UI" />
                <Setter Property="Margin"
                        Value="15 0 15 0" />
                <Setter Property="FontSize"
                        Value="26" />
            </Style>
        </ResourceDictionary>
    </UserControl.Resources>

    <Grid HorizontalAlignment="Stretch">
        <VisualStateManager.CustomVisualStateManager>
            <ei:ExtendedVisualStateManager />
        </VisualStateManager.CustomVisualStateManager>
        <VisualStateManager.VisualStateGroups>
            <VisualStateGroup x:Name="VisualStateGroup"
                              ei:ExtendedVisualStateManager.UseFluidLayout="True">
                <VisualStateGroup.Transitions>
                    <VisualTransition GeneratedDuration="0:0:0.5">
                        <VisualTransition.GeneratedEasingFunction>
                            <CircleEase EasingMode="EaseOut" />
                        </VisualTransition.GeneratedEasingFunction>
                    </VisualTransition>
                    <VisualTransition From="ShowQuestsOver" GeneratedDuration="0:0:0.5" To="Normal">
                    	<VisualTransition.GeneratedEasingFunction>
                    		<ExponentialEase EasingMode="EaseOut"/>
                    	</VisualTransition.GeneratedEasingFunction>
                    </VisualTransition>
                    <VisualTransition From="ShowBadgesOver" GeneratedDuration="0:0:0.5" To="Normal">
                    	<VisualTransition.GeneratedEasingFunction>
                    		<ExponentialEase EasingMode="EaseOut"/>
                    	</VisualTransition.GeneratedEasingFunction>
                    </VisualTransition>
                    <VisualTransition From="Normal" GeneratedDuration="0:0:0.5" To="MouseOverBadges"/>
                    <VisualTransition From="Normal" GeneratedDuration="0:0:0.5" To="MouseOverQuests"/>
                    <VisualTransition From="Normal" GeneratedDuration="0:0:0.5" To="MouseOverWhosOnline"/>
                    <VisualTransition From="Normal" GeneratedDuration="0:0:0.5" To="MouseOverRanklist"/>
                </VisualStateGroup.Transitions>
                <VisualState x:Name="Normal" />
                <VisualState x:Name="MouseOverBadges">
                	<Storyboard>
                		<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(FrameworkElement.Margin)" Storyboard.TargetName="BadgesBorder">
                			<DiscreteObjectKeyFrame KeyTime="0">
                				<DiscreteObjectKeyFrame.Value>
                					<Thickness>0,43,0,-43</Thickness>
                				</DiscreteObjectKeyFrame.Value>
                			</DiscreteObjectKeyFrame>
                		</ObjectAnimationUsingKeyFrames>
                	</Storyboard>
                </VisualState>
                <VisualState x:Name="MouseOverQuests">
                	<Storyboard>
                		<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(FrameworkElement.Margin)" Storyboard.TargetName="QuestsBorder">
                			<DiscreteObjectKeyFrame KeyTime="0">
                				<DiscreteObjectKeyFrame.Value>
                					<Thickness>0,45,0,-45</Thickness>
                				</DiscreteObjectKeyFrame.Value>
                			</DiscreteObjectKeyFrame>
                		</ObjectAnimationUsingKeyFrames>
                	</Storyboard>
                </VisualState>
                <VisualState x:Name="MouseOverWhosOnline">
                	<Storyboard>
                		<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(FrameworkElement.Margin)" Storyboard.TargetName="WhosOnlineBorder">
                			<DiscreteObjectKeyFrame KeyTime="0">
                				<DiscreteObjectKeyFrame.Value>
                					<Thickness>0,36,0,-36</Thickness>
                				</DiscreteObjectKeyFrame.Value>
                			</DiscreteObjectKeyFrame>
                		</ObjectAnimationUsingKeyFrames>
                	</Storyboard>
                </VisualState>
                <VisualState x:Name="MouseOverRanklist">
                	<Storyboard>
                		<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(FrameworkElement.Margin)" Storyboard.TargetName="RanklistBorder">
                			<DiscreteObjectKeyFrame KeyTime="0">
                				<DiscreteObjectKeyFrame.Value>
                					<Thickness>0,38,0,-38</Thickness>
                				</DiscreteObjectKeyFrame.Value>
                			</DiscreteObjectKeyFrame>
                		</ObjectAnimationUsingKeyFrames>
                	</Storyboard>
                </VisualState>
            </VisualStateGroup>
        </VisualStateManager.VisualStateGroups>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*" />
            <ColumnDefinition Width="Auto" />
        </Grid.ColumnDefinitions>

        <Grid Grid.ColumnSpan="2">
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
				<RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
            </Grid.RowDefinitions>

            <Grid x:Name="Controls" Height="92"
                  HorizontalAlignment="Stretch"
                  VerticalAlignment="Top">
                <Grid.RowDefinitions>
                    <RowDefinition Height="44" />
                    <RowDefinition Height="*" />
                </Grid.RowDefinitions>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto" />
                    <ColumnDefinition Width="Auto" />
                    <ColumnDefinition Width="Auto" />
                    <ColumnDefinition Width="*" />
                    <ColumnDefinition Width="Auto" />
                    <ColumnDefinition Width="Auto" />
                    <ColumnDefinition Width="Auto" />
                    <ColumnDefinition Width="Auto" />
                    <ColumnDefinition Width="Auto" />
                    <ColumnDefinition Width="Auto" />
                    <ColumnDefinition Width="Auto" />
                </Grid.ColumnDefinitions>

                <TiledBG:TiledBGControl x:Name="TopRibbonBackground" 
                                        Grid.Row="0"
                                        Grid.ColumnSpan="11"
                                        Height="43"
                                        HorizontalAlignment="Stretch"
                                        BorderBrush="Transparent"
                                        BorderThickness="0"
                                        TiledImageSource="images/ControlsRibbon/ToprowBG2.png"/>

				<Grid Grid.ColumnSpan="10"
                      Grid.RowSpan="2"
                      HorizontalAlignment="Stretch"
                      VerticalAlignment="Center">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="*" />
                        <ColumnDefinition Width="Auto" />
                        <ColumnDefinition Width="*" />
                    </Grid.ColumnDefinitions>
                    <Image Grid.Column="1"
                           Source="images/ControlsRibbon/WorldH.png">
                        <Image.Effect>
                            <DropShadowEffect Direction="0"
                                              BlurRadius="30"
                                              ShadowDepth="0"
                                              Opacity="0.795" />
                        </Image.Effect>
                    </Image>
                    <Border Grid.Column="0"
                            CornerRadius="2"
                            Width="200"
                            ToolTipService.ToolTip="Experience"
                            HorizontalAlignment="Right"
                            Margin="0 3 -2 0"
                            Height="8"
                            Background="#FFE2DC00" Opacity="0.5">
                    	<Border.Effect>
                    		<DropShadowEffect Color="#FF918B00" Direction="225" Opacity="0.885" ShadowDepth="4" BlurRadius="16"/>
                    	</Border.Effect>
                    </Border>
					<Border Grid.Column="0"
                            CornerRadius="2"
                            Width="{Binding Experience}"
                            HorizontalAlignment="Right"
                            ToolTipService.ToolTip="Experience"
                            Margin="0 3 -2 0"
                            Height="8"
                            Background="#FFCBC300">
                    </Border>
					
					<Border Grid.Column="2"
                            CornerRadius="2"
                            Width="200"
							HorizontalAlignment="Left"
                            ToolTipService.ToolTip="Health"
                            Margin="-2 3 0 0"
                            Height="8"
                            Background="#FF66E700" Opacity="0.5">
                    	<Border.Effect>
                    		<DropShadowEffect Color="#FF918B00" Direction="225" Opacity="0.885" ShadowDepth="4" BlurRadius="16"/>
                    	</Border.Effect>
                    </Border>
					<Border Grid.Column="2"
                            CornerRadius="2"
                            Width="{Binding Health}"
                            ToolTipService.ToolTip="Health"
                            HorizontalAlignment="Left"
                            Margin="-2 3 0 0"
                            Height="8" Background="#FF01D800">
                    </Border>
                </Grid>

                <TextBlock Grid.Column="0"
                           Grid.Row="0"
                           Text="{Binding Game.Player.Name}"
                           Style="{StaticResource TopRibbonLabelStyle}" />

                <Button Grid.Row="0"
                        Grid.Column="1"
                        x:Name="PartnersButton"
                        Margin="15 0 15 0"
                        VerticalAlignment="Center"
                        Command="{Binding ShowPartnersCommand}">
                    <Button.Template>
                        <ControlTemplate TargetType="Button">
                            <ContentPresenter Content="{TemplateBinding Content}" />
                        </ControlTemplate>
                    </Button.Template>
                    <TextBlock Text="partners"
                               FontFamily="Segoe UI"
                               Foreground="White"
                               FontSize="18" />
                </Button>
                
                <Button Grid.Row="0"
                        Grid.Column="2"
                        x:Name="LogoutButton"
                        Margin="15 0 15 0"
                        VerticalAlignment="Center"
                        Command="{Binding Game.UnsubscribeCommand}">
                    <Button.Template>
                        <ControlTemplate TargetType="Button">
                            <ContentPresenter Content="{TemplateBinding Content}" />
                        </ControlTemplate>
                    </Button.Template>
                    <TextBlock Text="log out"
                               FontFamily="Segoe UI"
                               Foreground="White"
                               FontSize="18" />
                </Button>

                <Button Grid.Column="4"
                        Margin="5 -43 5 0"
                        Grid.RowSpan="2"
                        Command="{Binding ShowBadgesCommand}"
                        VerticalAlignment="Top">
                	<i:Interaction.Triggers>
                		<i:EventTrigger EventName="MouseEnter">
                			<ei:GoToStateAction StateName="MouseOverBadges"/>
                		</i:EventTrigger>
                		<i:EventTrigger EventName="MouseLeave">
                			<ei:GoToStateAction StateName="Normal"/>
                		</i:EventTrigger>
                	</i:Interaction.Triggers>
                    <Button.Template>
                        <ControlTemplate TargetType="Button">
                            <ContentPresenter Content="{TemplateBinding Content}" />
                        </ControlTemplate>
                    </Button.Template>
                    <Border Height="118"
                            Width="52">
                        <Border x:Name="BadgesBorder">
                            <Border.Background>
                                <ImageBrush ImageSource="images/ControlsRibbon/badgesIcon.png" />
                            </Border.Background>
                        </Border>
                    </Border>
                </Button>

                <Button Grid.Column="5"
                        Margin="5 -45 5 0"
                        Grid.RowSpan="2"
                        Command="{Binding BrowseEventsCommand}"
                        VerticalAlignment="Top">
                	<i:Interaction.Triggers>
                		<i:EventTrigger EventName="MouseLeave">
                			<ei:GoToStateAction StateName="Normal"/>
                		</i:EventTrigger>
                		<i:EventTrigger EventName="MouseEnter">
                			<ei:GoToStateAction StateName="MouseOverQuests"/>
                		</i:EventTrigger>
                	</i:Interaction.Triggers>
                    <Button.Template>
                        <ControlTemplate TargetType="Button">
                            <ContentPresenter Content="{TemplateBinding Content}" />
                        </ControlTemplate>
                    </Button.Template>
                    <Border Height="120"
                            Width="52">
                        <Border x:Name="QuestsBorder">
                            <Border.Background>
                                <ImageBrush ImageSource="images/ControlsRibbon/QuestsIcon.png" />
                            </Border.Background>
                        </Border>
                    </Border>
                </Button>

                <Button Grid.Column="6"
                        Margin="5 -36 5 0"
                        Grid.RowSpan="2"
                        Command="{Binding ShowQuizCommand}"
                        VerticalAlignment="Top">
                	<i:Interaction.Triggers>
                		<i:EventTrigger EventName="MouseLeave">
                			<ei:GoToStateAction StateName="Normal"/>
                		</i:EventTrigger>
                		<i:EventTrigger EventName="MouseEnter">
                			<ei:GoToStateAction StateName="MouseOverWhosOnline"/>
                		</i:EventTrigger>
                	</i:Interaction.Triggers>
                    <Button.Template>
                        <ControlTemplate TargetType="Button">
                            <ContentPresenter Content="{TemplateBinding Content}" />
                        </ControlTemplate>
                    </Button.Template>
                    <Border Height="111"
                            Width="50">
                        <Border x:Name="WhosOnlineBorder">
                            <Border.Background>
                                <ImageBrush ImageSource="images/ControlsRibbon/Quizflag.png" />
                            </Border.Background>
                        </Border>
                    </Border>
                </Button>

                <Button Grid.Column="7"
                        Margin="5 -38 5 0"
                        Grid.RowSpan="2"
                        Command="{Binding ShowWallOfFameCommand}"
                        VerticalAlignment="Top">
                	<i:Interaction.Triggers>
                		<i:EventTrigger EventName="MouseLeave">
                			<ei:GoToStateAction StateName="Normal"/>
                		</i:EventTrigger>
                		<i:EventTrigger EventName="MouseEnter">
                			<ei:GoToStateAction StateName="MouseOverRanklist"/>
                		</i:EventTrigger>
                	</i:Interaction.Triggers>
                    <Button.Template>
                        <ControlTemplate TargetType="Button">
                            <ContentPresenter Content="{TemplateBinding Content}" />
                        </ControlTemplate>
                    </Button.Template>
                    <Border Height="113"
                            Width="49">
                        <Border x:Name="RanklistBorder">
                            <Border.Background>
                                <ImageBrush ImageSource="images/ControlsRibbon/ranklistflag.png" />
                            </Border.Background>
                        </Border>
                    </Border>
                </Button>

                <Image 		Source="images/ControlsRibbon/points.png"
                            Grid.Column="8"
                            Grid.Row="0"
                            Margin="10 0 0 0" />

                <TextBlock Grid.Column="9"
                           Grid.Row="0"
                           Width="90"
                           Text="{Binding Game.Player.Experience}"
                           TextAlignment="Left"
                           Style="{StaticResource TopRibbonLabelStyle}"
                           Margin="10 0 5 0"/>

                <HyperlinkButton    Grid.Column="10"
                                    x:Name="BecomeFanInFacebookButton"
                                    TargetName="_blank"
                                    ToolTipService.ToolTip="Share your feedback"
                                    NavigateUri="http://www.facebook.com/ImagineGreenWorld">
                    <HyperlinkButton.Template>
                        <ControlTemplate TargetType="HyperlinkButton">
                            <ContentPresenter Content="{TemplateBinding Content}" />
                        </ControlTemplate>
                    </HyperlinkButton.Template>
                    <Image 		Source="images/ControlsRibbon/feedback.png"
                                Width="38"
                                Height="38"
                                Margin="10 0 10 0" />
                </HyperlinkButton>
                
            </Grid>
        </Grid>

        <Grid Height="120"
              HorizontalAlignment="Right"
              Background="Transparent"
              VerticalAlignment="Top"
              Grid.Column="1"
              Margin="0 30 0 0">

            <controls:PieResultsControl Width="150"
                                        Height="120"/>

            <Ellipse x:Name="elipse"
                     Opacity="0"
                     Margin="0,0,67,41"
                     Stroke="#FFB21515"
                     HorizontalAlignment="Right"
                     Height="10"
                     VerticalAlignment="Bottom"
                     Width="10" />
            <TextBlock x:Name="Header_Copy"
                       TextWrapping="Wrap"
                       Text="Your"
                       Foreground="White"
                       FontFamily="Segoe UI"
                       FontSize="14.667"
                       FontWeight="Bold"
                       HorizontalAlignment="Right"
                       Margin="0,33,77,0"
                       Height="20"
                       VerticalAlignment="Top" />
            <TextBlock x:Name="Header_Copy1"
                       TextWrapping="Wrap"
                       Foreground="White"
                       Text="Activity"
                       FontFamily="Segoe UI"
                       FontSize="14.667"
                       FontWeight="Bold"
                       HorizontalAlignment="Right"
                       Margin="0,53,59,47" />

        </Grid>
    </Grid> 
</UserControl>